<template>
  <section>
    <el-card v-viewer class="section-content">
      <slot name="header">
        <h1 class="section-title">{{ title }}</h1>
      </slot>
      <slot />
    </el-card>
    <slot name="footer">
      <el-card v-if="Array.isArray(commentData)">
        <Footer :comment-data="commentData" />
      </el-card>
    </slot>
  </section>
  <!-- 评论列表 -->
</template>

<script>
import Footer from "@/components/Footer/index.vue";
/**
 * 页面基本模板，外部需要提供页面标题
 *
 * 内容、底部模块均可自定义
 */
export default {
  components: {
    Footer
  },
  props: {
    title: {
      // 页面标题
      type: String,
      default: "页面标题"
    },
    commentData: {
      // 评论列表数据
      type: Array
    }
  }
};
</script>

<style lang="scss" scoped>
h1 {
  text-align: center;
}
.section-title {
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid #f2f2f2;
  font-size: 20px;
}
.section-content {
  margin-bottom: 15px;
}
</style>
